VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "cProgressBar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

Private G_ProgressFrame As Control
Private G_ProgressBack As Control
Private G_ProgressBar As Control
Private G_MaxWidth As Variant

Public Function mHide()
    G_ProgressFrame.Visible = False
    G_ProgressBack.Visible = False
    G_ProgressBar.Visible = False
End Function

Public Sub SetProgress(pValue As Variant)
    G_ProgressBar.Width = G_MaxWidth * pValue
End Sub

Public Sub mShow(ByRef pUserForm As UserForm)
    Dim ctrl As Control
    For Each ctrl In pUserForm.Controls
        If ctrl.Name <> "bt_cancel" Then ctrl.Enabled = False
    Next
    If G_ProgressBar Is Nothing Then
        Set G_ProgressFrame = pUserForm.Controls.Add("Forms.Image.1", "tmpimg")
        With G_ProgressFrame
            .Width = pUserForm.InsideWidth * 0.9
            .Height = 50
            .Left = (pUserForm.InsideWidth / 2) - (.Width / 2)
            .Top = (pUserForm.InsideHeight / 3) - (.Height / 2)
            .SpecialEffect = 3
        End With
        Set G_ProgressBack = pUserForm.Controls.Add("Forms.Image.1", "tmpprg")
        With G_ProgressBack
            .Width = pUserForm.InsideWidth * 0.8
            .Left = (pUserForm.InsideWidth / 2) - (.Width / 2)
            .Height = 16
            .Top = (pUserForm.InsideHeight / 3) - (.Height / 2)
        End With
        Set G_ProgressBar = pUserForm.Controls.Add("Forms.Image.1", "tmpprg")
        With G_ProgressBar
            .Width = 0
            .BorderStyle = 0
            .BackColor = vbBlue
            .Left = G_ProgressBack.Left + 1
            .Height = G_ProgressBack.Height - 4.5
            .Top = G_ProgressBack.Top + 2
        End With
        G_MaxWidth = G_ProgressBack.Width - 2
    Else
        G_ProgressFrame.Visible = True
        G_ProgressBack.Visible = True
        G_ProgressBar.Visible = True
    End If
    pUserForm.Repaint
End Sub

